import 'package:hrf_app/common/index.dart';
import 'package:hrf_app/global.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get/get.dart';
import 'package:tdesign_flutter/tdesign_flutter.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Global.init();
  runApp(const MyApp());
//  await initializeService();
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return GetMaterialApp(
      title: 'Flutter Demo',
      initialRoute: RouteNames.systemSplash,
      getPages: RoutePages.list,
      debugShowCheckedModeBanner: false,

      theme: ThemeData(
          scaffoldBackgroundColor: Colors.grey[200], // 设置 Scaffold 的背景色
          extensions: [TDTheme.defaultData()],
          colorScheme: ColorScheme.light(
              primary: TDThemeData.defaultData().brandNormalColor),
          appBarTheme: AppBarTheme(
            iconTheme: IconThemeData(color: Colors.white),
            backgroundColor: TDTheme.of(context).brandClickColor,
            titleTextStyle: TextStyle(
                color: TDTheme.of(context).whiteColor1,
                fontSize: TDTheme.of(context).fontTitleLarge?.size),
            centerTitle: true,
          )),
      builder: (context, widget) {
        widget = EasyLoading.init()(context, widget);
        // EasyLoading 初始化
        return MediaQuery(data: MediaQuery.of(context), child: widget);
      },
    );
  }
}
